<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <input type="text" class="username">
    <br>
    <input type="text" class="password">
    <br>
    <button>登录</button>
    <a href="./reg.html">没有账号，去z注册</a>

    <script src="../js/ajax.js"></script>
    <script src="../js/api.js"></script>

    <script>
        const oUser = document.querySelector('.username');
        const oPwd = document.querySelector('.password');

        const oBtn = document.querySelector('button');

        oBtn.onclick = function () { 
            const username = oUser.value.trim() ;
            const password = oPwd.value.trim() ;
            login({
                username ,
                password
            } , data => {
                console.log(data);
            })
        }
    </script>

</body>

</html>